//
//  fixxApiObjectMapper.h
//  fixx
//
//  Created by Jonathan Williamson on 26/11/2009.
//  Copyright 2009 Hedgehog Lab. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface fixxApiObjectMapper : NSObject
{
@private
	NSString *username;
	NSString *password;
	NSString *url;
}

- (id)initWithUsername: (NSString *)_username password: (NSString *)_password andUrl: (NSString *)_url;

// Generic request methods
// -----------------------

// GET
- (id) requestObjectForApiExtension: (NSString *)extention;
- (id) requestObjectForApiExtension: (NSString *)extention andIds: (NSArray *)Ids;

// POST and PUT
- (NSInteger) sendObject: (NSMutableDictionary *)object forApiExtension: (NSString *)extention andRequestMethod: (NSString *)method;
- (NSInteger) sendObject: (NSMutableDictionary *)object forApiExtension: (NSString *)extention andIds: (NSArray *)Ids andRequestMethod: (NSString *)method;

// DELETE
- (id) deleteObjectForApiExtension: (NSString *)extention andIds: (NSArray *)Ids;


// Projects
// --------

- (NSMutableArray *)getAllProjects;
- (NSMutableDictionary *)getProjectWithId: (NSInteger)ID;

- (NSInteger)createProjectFromObject: (NSMutableDictionary *)object;

- (NSInteger)updateProjectFromObject: (NSMutableDictionary *)object;


// Resolutions
// -----------

- (NSMutableArray *)getAllResolutionsForProjectWithId: (NSInteger)ID;
- (NSMutableArray *)getAllIssueTypesForProjectWithId: (NSInteger)ID;


// Areas
// -----

- (NSMutableArray *)getAllVersionsForProjectWithId: (NSInteger)ID;
- (NSMutableArray *)getReleasedVersionsForProjectWithId: (NSInteger)ID;


// Issues
// ------

- (NSMutableArray *)getAllIssuesForProjectWithId: (NSInteger)ID;
- (NSMutableArray *)getAllIssuesWithQuerystrings: (NSArray *)strings;
- (NSMutableDictionary *)getIssueWithId: (NSInteger)ID;

- (NSInteger)createIssueFromObject: (NSMutableDictionary *)object;

- (NSInteger)updateIssueWithId: (NSInteger)ID fromObject: (NSMutableDictionary *)object;


// Comments
// --------

- (NSMutableArray *)getAllCommentsForIssueWithId: (NSInteger)ID;

- (NSInteger)addCommentToIssueWithId: (NSInteger)ID fromObject: (NSMutableDictionary *)object;

- (NSInteger)deleteCommentWithId: (NSInteger)commentId fromIssueWithId: (NSInteger)issueId;


// Timelogs
// --------

- (NSMutableDictionary *)getAllTimelogsForIssueWithId: (NSInteger)ID;

- (NSInteger)addTimelogToIssueWithId: (NSInteger)ID fromObject: (NSMutableDictionary *)object;

- (NSInteger)deleteTimelogWithId: (NSInteger)timelogId fromIssueWithId: (NSInteger)issueId;


// Tags
// ----

- (NSMutableArray *)getAllTagsForIssueWithId: (NSInteger)ID;

- (NSInteger)addTagToIssueWithId: (NSInteger)ID fromObject: (NSMutableDictionary *)object;

- (NSInteger)deleteTagWithId: (NSInteger)tagId fromIssueWithId: (NSInteger)issueId;


// Changelogs
// ----------

- (NSMutableArray *)getAllChangelogsForIssueWithId: (NSInteger)ID;


// Users
// -----

- (NSMutableArray *)getAllUsers;

- (NSMutableDictionary *)getUserWithId: (NSInteger)ID;
- (NSMutableDictionary *)getUserWithUsername: (NSString *)username;
- (NSMutableArray *)getUsersForProjectWithId: (NSInteger)ID;
- (NSMutableArray *)getClientsForProjectWithId: (NSInteger)ID;
- (NSMutableArray *)getUsersWatchingIssueWithId: (NSInteger)ID;
- (NSMutableArray *)substribeUserWithId: (NSInteger)userId toIssueWithId: (NSInteger)issueId;


// Priorities
// ----------

- (NSMutableArray *) getAllPriorities;
- (NSMutableDictionary *) getPriorityWithId: (NSInteger)ID;


@end
